package com.sqx.modules.health.controller;

import com.alibaba.fastjson.JSONObject;
import com.sqx.modules.health.common.Result;
import com.sqx.modules.health.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author gxy
 * @since 2022-05-13
 */

@Api(value = "", tags = "", description = "")
@RestController
@RequestMapping("/health/reports")
public class ReportsController {

    @Autowired
    private IReportService reportService;

    final public List ruturnList= new ArrayList();

    /**
     * 获取用户信息
     * 结束检测
     * @param uid
     * @return
     */
    // 新增或更新
    @GetMapping("/bloodreport")
    @ApiOperation(value = "动态血压报表", notes = "动态血压报表")
    public Result getBloodReoprt1(@RequestParam Long uid) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("uid",uid);
        //获取数据
        Boolean re = reportService.fillBloodTemplate(jsonObject); // 首先获取用户表所有信息
        return Result.success(re);
    }

    @GetMapping("/getBloodReport")
    public Result getBloodReport(@RequestParam String uid,
                                  @RequestParam String recordid,
                                  @RequestParam String docid,
                                 @RequestParam String paintid,
                                 @RequestParam String docname,
                                 @RequestParam(required = false, defaultValue = "") Integer type) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("uid",uid);
        jsonObject.put("recordid",recordid);
        jsonObject.put("docid",docid);
        jsonObject.put("paintid",paintid);
        jsonObject.put("docname",docname);
        //获取数据
        Boolean re = reportService.fillBloodTemplate(jsonObject); // 首先获取用户表所有信息
        return Result.success(re);
    }

}

